package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.app.utils.UserContext;
import cn.wolfcode.trip.base.domain.StrategyReplyComment;
import cn.wolfcode.trip.base.domain.StrategySunComment;
import cn.wolfcode.trip.base.query.StrategySunCommentQueryObject;
import cn.wolfcode.trip.base.service.*;
import cn.wolfcode.trip.base.utils.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletContext;
import java.util.Date;

@Controller
@RequestMapping("/strategySunComments")
public class StrategySunCommentController {

    @Autowired
    private IStrategyService strategyService;
    @Autowired
    private IStrategySunCommentService sunCommentService;
    @Autowired
    private IStrategyReplyCommentService replyCommentService;


    @PostMapping("/replyComments")
    @ResponseBody
    public Object saveStrategySunComment(StrategyReplyComment replyComment){
        JSONResult result = new JSONResult();
        try{
            replyComment.setReplyUser(UserContext.getCurrentUser());
            replyComment.setCreateTime(new Date());
            replyCommentService.save(replyComment);
        }catch(Exception e){
            e.printStackTrace();
            result.mark(e.getMessage());
        }
        return result;
    }




}
